<?php

namespace IMT\AccountBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * IMT\AccountBundle\Entity\Account
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="IMT\AccountBundle\Repository\AccountRepository")
 */
class Account
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string $title
     *
     * @ORM\Column(name="title", type="string", length=255)
     */
    private $title;
    
    /**
     * @var string $color
     *
     * @ORM\Column(name="color", type="string", length=255)
     */
    private $color;

    /**
     * @var string $userName
     *
     * @ORM\Column(name="userName", type="string", length=255)
     */
    private $userName;

    /**
     * @var string $password
     *
     * @ORM\Column(name="password", type="string", length=255)
     */
    private $password;

    /**
     * @var boolean $active
     *
     * @ORM\Column(name="active", type="boolean")
     */
    private $active;
    
//     /**
//      * @ORM\OneToMany(targetEntity="IMT\EventBundle\Entity\ParticipantEvent", mappedBy="account")
//      */
//     private $events;
        
    /**
     * @ORM\ManyToOne(targetEntity="IMT\UserBundle\Entity\User", inversedBy="accounts")
     * @ORM\joinColumn(name="user_id", referencedColumnName="id")
     */
    private $user;
    
    /**
     * @ORM\OneToOne(targetEntity="IMT\UserBundle\Entity\Group", mappedBy="account", cascade={"persist"})
     * @ORM\joinColumn(name="group_id", referencedColumnName="id")
     */
    private $group;
    
    /**
     * @ORM\ManyToOne(targetEntity="IMT\AccountBundle\Entity\AccountType", inversedBy="account")
     * @ORM\joinColumn(name="account_type_id", referencedColumnName="id")
     */
    private $account_type;
    
    /**
     * @ORM\ManyToMany(targetEntity="IMT\UserBundle\Entity\Participant", inversedBy="accounts")
     * @ORM\JoinTable(name="account_participants",
     *      joinColumns={@ORM\JoinColumn(name="account_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="participant_id", referencedColumnName="id")}
     * )
     */
    private $participants;
    
    /**
     * @ORM\OneToMany(targetEntity="IMT\EventBundle\Entity\ParticipantEvent", mappedBy="account")
     */
    private $events;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set title
     *
     * @param string $title
     */
    public function setTitle($title)
    {
        $this->title = $title;
    }

    /**
     * Get title
     *
     * @return string 
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set userName
     *
     * @param string $userName
     */
    public function setUserName($userName)
    {
        $this->userName = $userName;
    }

    /**
     * Get userName
     *
     * @return string 
     */
    public function getUserName()
    {
        return $this->userName;
    }

    /**
     * Set password
     *
     * @param string $password
     */
    public function setPassword($password)
    {
        $this->password = $password;
    }

    /**
     * Get password
     *
     * @return string 
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set active
     *
     * @param boolean $active
     */
    public function setActive($active)
    {
        $this->active = $active;
    }

    /**
     * Get active
     *
     * @return boolean 
     */
    public function getActive()
    {
        return $this->active;
    }
    public function __construct()
    {
        $this->participants = new \Doctrine\Common\Collections\ArrayCollection();
    	$this->events = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Set color
     *
     * @param string $color
     */
    public function setColor($color)
    {
        $this->color = $color;
    }

    /**
     * Get color
     *
     * @return string 
     */
    public function getColor()
    {
        return $this->color;
    }

    /**
     * Set user
     *
     * @param IMT\UserBundle\Entity\User $user
     */
    public function setUser(\IMT\UserBundle\Entity\User $user)
    {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return IMT\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set group
     *
     * @param IMT\UserBundle\Entity\Group $group
     */
    public function setGroup(\IMT\UserBundle\Entity\Group $group)
    {
        $this->group = $group;
    }

    /**
     * Get group
     *
     * @return IMT\UserBundle\Entity\Group 
     */
    public function getGroup()
    {
        return $this->group;
    }

    /**
     * Add participants
     *
     * @param IMT\UserBundle\Entity\Participant $participants
     */
    public function addParticipant(\IMT\UserBundle\Entity\Participant $participants)
    {
        $this->participants[] = $participants;
    }

    /**
     * Get participants
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getParticipants()
    {
        return $this->participants;
    }

    /**
     * Add events
     *
     * @param IMT\EventBundle\Entity\ParticipantEvent $events
     */
    public function addParticipantEvent(\IMT\EventBundle\Entity\ParticipantEvent $events)
    {
        $this->events[] = $events;
    }

    /**
     * Get events
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getEvents()
    {
        return $this->events;
    }

    /**
     * Set account_type
     *
     * @param IMT\AccountBundle\Entity\AccountType $accountType
     */
    public function setAccountType(\IMT\AccountBundle\Entity\AccountType $accountType)
    {
        $this->account_type = $accountType;
    }

    /**
     * Get account_type
     *
     * @return IMT\AccountBundle\Entity\AccountType 
     */
    public function getAccountType()
    {
        return $this->account_type;
    }
}